/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2019-2021. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * Description:
 * Author: huawei
 * Create: 2019-10-15
 */

#ifndef DEVDRV_PCIE_LINK_INFO_H
#define DEVDRV_PCIE_LINK_INFO_H

#include "devdrv_interface.h"

void devdrv_set_pcie_channel_status(u32 status);

typedef enum {
    DEVDRV_PCIE_LINK_STATUS_OK          = 0,
    DEVDRV_PCIE_LINK_STATUS_DOWN        = 1,
    DEVDRV_PCIE_LINK_STATUS_CHANNEL_ERR = 2,
} DEVDRV_PCIE_LINK_STATUS;

typedef enum {
    DEVDRV_PCIE_COMMON_CHANNEL_OK  = 0,
    DEVDRV_PCIE_COMMON_CHANNEL_ERR = 1,
} DEVDRV_PCIE_CHANNEL_STATUS;

/*             pcie mac link            */
/****************************************/
#define PCIE_BASE_ADDR 0xA0200000U
#define PCIE_REG_SIZE 0x100000
#define PCIE_MAC_REG_BASE 0x70000U
#define PCIE_MAC_REG_LINK_ADDR 0x60U
#define PCIE_MAC_REG_LINK_LTSSM_ST_OFFSET 24U
#define PCIE_MAC_REG_LINK_LTSSM_L0 16U
#define PCIE_MAC_REG_LINK_SPEED_OFFSET 8U

#endif
